package com.xiao.hao.enums;


import cn.hutool.core.collection.CollUtil;
import com.xiao.hao.resp.BaseEnums;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.List;

//用药指导
@Getter
@AllArgsConstructor
public enum MedicationGuidanceEnum {

    Problem_1("0", "餐前"),
    Problem_2("1", "餐后"),
    Problem_3("2", "空腹"),
    Problem_4("3", "随餐服用"),
    Problem_5("4", "睡前");

    private final String code;
    private final String name;

    public static String getNameByValue(String code) {
        for (MedicationGuidanceEnum typeEnum : values()) {
            if (typeEnum.getCode().equals(code)) {
                return typeEnum.getName();
            }
        }
        return null;
    }

    public static List<BaseEnums> getEnumRespList() {
        List<BaseEnums> respList = CollUtil.newArrayList();
        for (MedicationGuidanceEnum baseUnitEnum : values()) {
            respList.add(new BaseEnums(baseUnitEnum.getCode(), baseUnitEnum.getName()));
        }
        return respList;
    }


}
